<template>
	<view :class="[activity.config.style]">
		<view class="feedback">
			<form @submit="formSubmit" @reset="formReset">
				<view class="uni-title title">建议/意见</view>
				<view class="uni-textarea textarea">
					<textarea name="content" placeholder-style="color:#666" placeholder="请填写具体内容帮助我们了解您的建议或意见." />
				</view>
				<view class="submit">
					<button class="button" hover-class="button-hover" type="default" form-type="submit">确认提交</button>
				</view>
			</form>
		</view>
	</view>
</template>

<script>
	import Base from '@/muu_activity/common/base.vue'
	
	export default {
		extends:Base,
		data() {
			return {
				
			}
		},
		async onLoad(option) {
			await this.$onLaunched
			await this.baseIsReady()
		},
		created() {

		},

		methods: {
			
			//数据提交
			formSubmit: function(e){
				console.log(e)
				console.log('提交表单')
				let content = e.detail.value.content
				//获取全局配置
				let url = ''
					//#ifdef MP-WEIXIN
					url = 'entry/wxapp/feedback'
					//#endif
					//#ifdef H5
					url = 'entry/site/feedback'
					//#endif
				this.util.request({
					url : url,
					data: {
						'content': content,
						'action': 'add'
					},
					method: 'POST',
					success: function (res) {
						console.log(res.data);
						if (res.data.code == 200) {
							uni.showModal({
								title: '温馨提示',
								content: res.data.msg,
								success: ()=> {
									console.log('点击确认')
								}
							})
						}else{
							uni.showToast({
							    title: res.data.msg,
							    duration: 2000
							});
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #f8f8f8;
		min-height: 100%;
		height: auto;
	}
	.feedback {
		padding: 20rpx;
		.title {
			font-size: 48rpx;
			line-height: 76rpx;
			font-weight: 700;
		}
		.textarea {
			border: 2rpx solid #ccc;
			border-radius: 10rpx;
			background-color: #fff;
			padding: 16rpx;
			font-size: 28rpx;
			margin-bottom: 20rpx;
		}
		.submit {
			position: fixed;
			bottom: 20rpx;
			left: 20rpx;
			right: 20rpx;
			.button {
				display: block;
				color: #fff;
			}
			.button-hover {
				color: #fff;
			}
		}
		
	}
	.Blue {
		.submit {
			.button {
				background-color: $Blue;
			}
			.button-hover {
				background-color: $Blue-hover;
			}
		}
	}
	.Green {
		.submit {
			.button {
				background-color: $Green;
			}
			.button-hover {
				background-color: $Green-hover;
			}
		}
	}
	.LightRed {
		.submit {
			.button {
				background-color: $LightRed;
			}
			.button-hover {
				background-color: $LightRed-hover;
			}
		}
	}
	.Orange {
		.submit {
			.button {
				background-color: $Orange;
			}
			.button-hover {
				background-color: $Orange-hover;
			}
		}
	}
	.LightPink {
		.submit {
			.button {
				background-color: $LightPink;
			}
			.button-hover {
				background-color: $LightPink-hover;
			}
		}
	}
	.Magenta {
		.submit {
			.button {
				background-color: $Magenta;
			}
			.button-hover {
				background-color: $Magenta-hover;
			}
		}
	}
</style>
